//
//  DiseaseSubdivisionController.m
//  quickDoctor
//
//  Created by zhaowei on 17/3/10.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "DiseaseSubdivisionController.h"

@interface DiseaseSubdivisionController ()<UITableViewDelegate,UITableViewDataSource>

@end

static NSString *divisionCell = @"divisionCell";
@implementation DiseaseSubdivisionController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
}

- (void)setupUI{
    
    self.title = @"疾病细分";
    
    //添加tableView
    //添加tableView
    UITableView *tableView = [[UITableView alloc] init];
    [self.view addSubview:tableView];
    
    tableView.dataSource = self;
    tableView.delegate = self;
    //注册cell
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:divisionCell];
    
    //下方留空白
    tableView.tableFooterView = [UIView new];
    //约束
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
    }];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 11;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:divisionCell forIndexPath:indexPath];
    
    cell.textLabel.text = [NSString stringWithFormat:@"第%zd行",indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    //pop
    [self.navigationController popViewControllerAnimated:YES];
    
    //获取字符串
    NSString *str = [NSString stringWithFormat:@"第%zd行",indexPath.row];
    //发送通知
    [[NSNotificationCenter defaultCenter] postNotificationName:@"divisionPop" object:nil userInfo:@{@"text":str}];
    
    
}
@end
